<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Grom Hellscream
 * Date: 11/2/12
 * Time: 8:40 AM
 * To change this template use File | Settings | File Templates.
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$phongs = $this->get('phong');
$phong = $phongs[0];
$donvi = $this->get('donvi');
$khoi = $this->get('khoi');
$lanhdaos = $this->get('lanhDaos');
$canboinfos = $this->get('thongTinNhanSu');
$hosocanbo = VastHelper::getHosocanbo();
$phonglanhdao = VastHelper::getPhongLanhDao();
?>

<div id="crumbs">
    <div style="color: #222222;font-weight: normal;margin: 0;padding: 0">
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=vast') ?>">Trang chủ</a> »
        <span>Cơ cấu tổ chức</span> »
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=donvitructhuoc&id=' . $khoi->id); ?>"><?php echo $khoi->ten ?></a> »                
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=phongtructhuocs&id=' . $donvi->id); ?>"><?php echo $donvi->ten ?></a> »
        <span><?php echo $phong->ten; ?></span>        
    </div>
</div>

<div id="main" class="home">
    <h3 class="title green">
        <?php echo $phong->ten; ?>
        <?php if (JFactory::getUser()->authorise('vast.phong.edit', 'com_vast') || (JFactory::getUser()->authorise('vast.phong.edit.own', 'com_vast') && $phonglanhdao !== NULL && $phonglanhdao->phongid == $phong->id)): ?>
        <a href="index.php?option=com_vast&view=phong&layout=edit&id=<?php echo $donvi->id; ?>" style="font-size: 10px;font-style: italic;text-decoration:underline;">Cập nhật</a>
        <?php endif; ?>
    </h3>
    <div class="single">
        <?php if (file_exists($phong->hinhanh)) { ?>
            <img width="300" height="225" src="<?php echo $phong->hinhanh; ?>" alt="<?php echo $phong->ten; ?>" class="alignright size-medium wp-image-83"/>
        <?php } else { ?>
            <img width="300" height="225" src="<?php echo $this->baseurl . '/media/com_vast/images/default_image.jpg'; ?>" class="alignright size-medium wp-image-83"/>
        <?php } ?>
        <p style="text-align:justify;text-justify:inter-word;">
            <strong style="text-indent: 20px;">
                + Trực thuộc:
            </strong>
            <?php echo $donvi->ten; ?>
        </p>
        <p style="text-align:justify;text-justify:inter-word;">
            <strong style="text-indent: 20px;">
                + Điện thoại:
            </strong>
            <?php
            if (strlen($phong->sodienthoai) <= 0) {
                echo 'Chưa có số điện thoại';
            } else {
                echo $phong->sodienthoai;
            }
            ?>
        </p>
        <p style="text-align:justify;text-justify:inter-word;">
            <strong style="text-indent: 20px;">
                + Giới thiệu:
            </strong>
            <?php echo $phong->gioithieu; ?>
        </p>
    </div>
    <div id="homeColumns">
    
        <div class="widget wpzoomWidget column">
            <h3 class="title blue">
                Cơ cấu lãnh đạo phòng
            </h3>
            <?php if (count($lanhdaos) <= 0): ?>
            <ul class="posts">
                <li>&gt; Chưa có dữ liệu</li>
            </ul>
            <div class="cleaner">&nbsp;</div>
            <?php else: ?>
                <?php foreach ($lanhdaos as $lanhdao): ?>
                    + Lãnh đạo phòng: <br />
                    <li>
                        <div class="cover">
                            <a title="<?php echo $lanhdao->hoten ?>"><img height="60" width="80" alt='<?php echo $lanhdao->hoten; ?>' src='<?php if (isset($lanhdao->anhdaidien) && $lanhdao->anhdaidien != '') echo $this->baseurl . '/' . $lanhdao->anhdaidien; else echo $this->baseurl . '/media/com_vast/images/default_image.jpg'; ?>'/></a>
                        </div>
                        <h2>
                            <a href='<?php echo "index.php?option=com_vast&amp;view=chitietcanbo&amp;id=" . $lanhdao->id; ?>'><?php echo $lanhdao->hoten; ?></a>
                        </h2>
                        <p>
                            <?php 
                                echo '+ Chức danh: ' . $lanhdao->chucdanh . '<br/>';
                                echo '+ Số điện thoại: ' . $lanhdao->dienthoai . '<br/>';
                                echo '+ Di động: ' . $lanhdao->didong . '<br/>'; 
                            ?>
                        </p>
                        </li>
                <?php endforeach; ?>                   
            <?php endif; ?>
        </div>
    
        <div class="widget wpzoomWidget column column-last">
            <h3 class="title brown">
                Thông tin nhân sự
            </h3>
            <ul class="posts">
                <?php if (count($canboinfos) <= 0): ?>
                <li>&gt; Chưa có dữ liệu</li>
                <?php else: ?>
                <?php foreach ($canboinfos as $key=>$value): ?>
                +&nbsp;<?php echo $key . $value; ?><br />
                <?php endforeach; ?>
                <li>
                </li>
                <?php endif; ?>
            </ul>
            
            <div class="cleaner">&nbsp;</div>
        </div>
    
    </div>

    <div style="float: left; width: 680px;">
        <?php
        $url = htmlspecialchars($_SERVER['HTTP_REFERER']);
        echo '<a title="Quay lại" href="' . $url . '"><span style="left: 600px; position: relative;">&laquo; Quay lại</span></a>';
        ?>    
    </div>
</div>